#include "aicommandmovetoia.h"

namespace IAlib
{

AiCommandMoveToIA::AiCommandMoveToIA()
{
    AiCommand::setType(COMMAND_MOVE_TO_AI);
}

QByteArray AiCommandMoveToIA::toByteArray() const
{
    QByteArray byte_array;
    QDataStream data(&byte_array, QIODevice::WriteOnly);

    data<<getMode();
    data<<getAgentId();
    data<<getAgentTargetId();
    data<<getDisplacementType();
    data<<getVehicleId();

    return byte_array;
}

void AiCommandMoveToIA::fromByteArray(QByteArray &byte_array)
{
    QDataStream data(&byte_array, QIODevice::ReadOnly);
    int i_temp;
    QString s_temp;

    data>>i_temp;
    setMode((AiCommand::CommandMode)i_temp);
    data>>s_temp;
    setAgentId(s_temp);
    data>>m_agent_target_id;
    data>>i_temp;
    setDisplacementType((DisplacementType)i_temp);
    data>>s_temp;
    setVehicleId(s_temp);
}

}
